#!/usr/bin/env python3
# vim:fileencoding=utf-8

import sys
import email

from mailutils import decode_multiline_header

def main(header):
  msg = email.message_from_binary_file(sys.stdin.buffer)
  h = msg.get(header, '')
  h = decode_multiline_header(h)
  sys.stdout.write(h)

if __name__ == '__main__':
  main(sys.argv[1]) if len(sys.argv) == 2 else sys.exit('which header do you want?')
